package cn.bgs.controller;

import cn.bgs.page.PageRequest;
import cn.bgs.pojo.CommunityActivities;
import cn.bgs.service.ActivityService;
import cn.bgs.utils.R;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/Activity")
public class ActivityController {
    @Autowired
    private ActivityService activityService;
    @GetMapping("/activitySelect")
    public PageInfo<CommunityActivities> activitySelect(PageRequest pageRequest,String activityTheme){
        PageInfo<CommunityActivities> allUser = activityService.activitySelect(pageRequest,activityTheme);
        return allUser;
    }
    @GetMapping("/middle")
    public R middle(){
        return activityService.middle();
    }
    @PostMapping("/activityAdd")
    public R activityAdd(@RequestBody CommunityActivities communityActivities){
        return activityService.activityAdd(communityActivities);
    }
    @PostMapping("/activityUpdate")
    public R activityUpdate(@RequestBody CommunityActivities communityActivities){
        return activityService.activityUpdate(communityActivities);
    }
    @GetMapping("/activityDelect")
    public R activityDelect(Integer communityActivitiesId){
        return activityService.activityDelect(communityActivitiesId);
    }
}
